<?php

use think\migration\Seeder;
use app\admin\model\ReceiveAddressModel;
use think\Db;

class UserSeeder extends Seeder
{

    /**
     * Run Method.
     *
     * Write your database seeder using this method.
     *
     * More information on writing seeders is available here:
     * http://docs.phinx.org/en/latest/seeding.html
     */
    public function run()
    {
        for ($i = 0; $i <= 50; $i++) {
            $address = new \app\admin\model\UserModel();
            $address->save($this->faker());
        }

    }

    public function faker()
    {

        $faker = Faker\Factory::create('zh_CN');
        $avatars = [
            'admin/20200429/14d39cda4c03f5e313860e78f0699f9f.jpg',
            'admin/20200429/2ea886e87deb897927be94c109ba4699.jpg',
            'admin/20200429/2ea886e87deb897927be94c109ba4699.jpg',
            'admin/20200429/2ea886e87deb897927be94c109ba4699.jpg',
            'admin/20200513/6005c93e482e4631ce732ee425d9667c.jpg',
        ];
        return [
            'user_login'      => $faker->name,
            'user_pass' => '###5583f71b1fd397dca8914b44e3a32fde',
            'user_nickname'      => $faker->name,
            'user_email' => $faker->email,
            'avatar' => $faker->randomElement($avatars),
            'signature' => '足球评论员',
            'tag' => '近三场中三场',
            'desc' => '一个大美女',
            'publish_num' => mt_rand(1,100),
            'fans_num' => mt_rand(1,100),
            'praise_num' => mt_rand(1,190),
            'type' => mt_rand(0,2),
            'sort' => mt_rand(1,100),
        ];
    }
}